package com.mai.erp.controller;

import com.mai.erp.domain.vo.ProductQueueVO;
import com.mai.erp.res.Result;
import com.mai.erp.service.DispatchService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author : Wang
 * @version : 1.0
 * @since : 2025/6/17 上午9:26
 */
@RestController
@RequestMapping("/dispatch")
public class DispatchController {

    @Resource
    private DispatchService dispatchService;

    @PostMapping("/proceed/{workStationId}")
    public Result<String> proceed(@PathVariable Integer workStationId) {
        dispatchService.proceed(workStationId);
        return Result.success("正在加工中");
    }

    @PostMapping("/complete/{workStationId}")
    public Result<String> complete(@PathVariable Integer workStationId) {
        dispatchService.complete(workStationId);
        return Result.success("处理成功");
    }

    @GetMapping("/list/{workStationId}")
    public Result<List<ProductQueueVO>> getQueueIngDispatches(@PathVariable Integer workStationId) {
        return Result.success(dispatchService.getQueueIngDispatches(workStationId));
    }
}
